<script lang="ts" setup>
import { NavBar } from 'vant';
import { OrderApi } from '~/api/OrderApi';

const route = useRoute()
const router = useRouter()

const oldEra = ref([] as number[])

onMounted(async () => {
  oldEra.value = await OrderApi.archievedEra()
})

function checkEra(era: number) {
  router.push(`/orders?era=${era}`)
}
</script>

<template>
  <div>
    <NavBar
      title="往年订单"
    />
    <div p4>
      <div text-center>请选择要查看的年份</div>
      <div mx-auto my2 w-200px paper text-center
        v-for="era in oldEra" :key="era"
        @click="checkEra(era)">{{ era }}</div>
    </div>
  </div>
</template>

<style scoped>

</style>
